<template>
  <div class="slider-container">
    <el-row class="tac">
      <el-col :span="12">
        <el-menu
          @select="menuSelect"
          default-active="0"
          class="el-menu-vertical-demo"
          background-color="#fff"
          text-color="#999"
          active-text-color="#2d3a4b"
        >
          <el-menu-item
            class="menu-container"
            v-for="(item, index) of menu"
            :key="index"
            :index="index.toString()"
          >
            <i :class="['iconfont ', item.icon]"></i>
            <span slot="title" class="menu-text">{{ item.title }}</span>
          </el-menu-item>
        </el-menu>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { NAV } from "@/config/config";
export default {
  name: "SideBar",
  data() {
    return {
      visible: true,
      menu: NAV
    };
  },
  methods: {
    menuSelect(key) {
      let targetCourse = NAV.filter((item, index) => {
        return key == index;
      });
      this.$router.push({ path: targetCourse[0].field });
    }
  }
};
</script>

<style lang="scss" scoped>
.slider-container {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1;
  padding-top: 70px;
  width: 200px;
  height: 100%;
  background-color: #fff;
  border-right: 1px solid #e5e5e5;
}
.el-col {
  width: 200px;
}
.menu-container {
  width: 200px;
  height: 90px;
  padding: 20px;
  box-sizing: border-box;
  font-size: 16px;
  .menu-text {
    margin-left: 14px;
  }
}
.el-menu-item:hover {
  background-color: #c5ccd6;
}

// .tac{
//   width:400px;
//   height: 100%;
// }
</style>
